package shitoujiandaobu;

public class GuessGame {

    private Computer computer = new Computer();
    private Player player = new Player();

    public void run() {
        for (int i = 1; i <= 10; i++) {
            computer.generateNumbers();
            player.generateNumbers();
            // 0 石头  1 剪刀  2 布
            int computerNumber = computer.getNumber();
            int playerNumber = player.getNumber();
            if (computerNumber == playerNumber) {
                System.out.println("电脑出的是"+computerNumber);
                System.out.println("平局+1分");
                player.score += 1;
            } else if (computerNumber == 0 && playerNumber == 2 || computerNumber == 1 && playerNumber == 0 || computerNumber == 2 && playerNumber == 1) {
                System.out.println("电脑出的是"+computerNumber);
                System.out.println("你赢了加3分");
                player.score += 3;
            } else {
                System.out.println("电脑出的是"+computerNumber);
                System.out.println("你输了扣2分");
                player.score -= 2                                                                                           ;
            }
        }


        System.out.println("你得到了"+player.score+"分");
    }

    public static void main(String[] args) {
        new GuessGame().run();
    }
}
